﻿package idv.cjcat.monica.platformer.player {
	import idv.cjcat.rusher.engine.logger.LogType;
	
	public class WallPushingState extends PlayerState {
		
		public function WallPushingState(controller:PlayerController, direction:Number) {
			super(controller, direction);
			controller.engine.logger.log("Entered state: WallPushingState", LogType.INFO, controller);
		}
		
		override public function startJump():void {
			if (controller.jumpCount < PlayerController.MAX_JUMPS) {
				setState(JumpingUpState);
				setPlayerMovieClip(renderTarget.jumpingUpVertical, false);
			}
		}
		
		override public function onTick(time:Number):void {
			if (controller.moving) {
				if (controller.direction != controller.wallingDirection) {
					if (controller.dashing) {
						setState(RunningState);
						setPlayerMovieClip(renderTarget.running, true);
					} else {
						setState(WalkingState);
						setPlayerMovieClip(renderTarget.moving, true);
					}
				}
			} else {
				setState(StandingState);
				return;
			}
		}
	}
}
